package test;

import java.util.List;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import test.webservice.HelloWorld;
import test.webservice.User;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
       
    	JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    	factory.getInInterceptors().add(new LoggingInInterceptor());
    	factory.getOutInterceptors().add(new LoggingOutInterceptor());
    	factory.setServiceClass(HelloWorld.class);
    	factory.setAddress("http://localhost:8080/webservice-0.0.1-SNAPSHOT/HelloWorld");
    	HelloWorld client = (HelloWorld) factory.create();
    	 
    	client.addUser("jul","hac");
    	 
    	List<User> users = client.getUsers("jul","hac");
    	
    	for (User user : users) {
			System.out.println(user.getPrenom()+" "+user.getNom());
		}
    }
}
